<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
<title>商品列表</title>
<link rel="stylesheet" href="lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">

<!-- 分页样式 -->
	<style type="text/css">
		.box-footer{
			width:300px;
			height:30px;
			margin-left: 1200px; 
		}
		 .box-footer ul>li{
			float: left;
			margin-left: 25px;
		} 
		.form-group{
		margin-left: 100px;
		}
	</style>
</head>
<body class="pos-r">
<div >
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 商品列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<form action="<%=basePath%>shop/deleteBath.do">
			<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l">
				<input type="hidden" name="uid" value="<%=uid%>">
				<button type="submit" class="btn btn-danger radius" id="" name=""><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</button>
			 	<a class="btn btn-primary radius"  href="<%=basePath%>shop/product_add.do"><i class="Hui-iconfont">&#xe600;</i> 添加产品</a></span> 
			 </div>
		 
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
							<th width="40"><input name="" type="checkbox" value=""></th>
							<th width="40">商品编号</th>
							<th width="60">商品图片</th>
							<th width="100">商品名称</th>
							<th>商品描述</th>
							<th width="80">单价</th>
							<th width="60">发布状态</th>
							<th width="60">商品库存</th>
							<th width="60">上架时间</th>
							<th width="50">申请商品上架审核</th>
							<th width="70">申请商品修改审核</th>
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:if test="${list!=null }">
	    					<c:forEach items="${list}" var="shop">
								<tr class="text-c va-m">
									<td><input name="shop_id" type="checkbox" value="${shop.shop_id }"></td>
									<td>${shop.shopnumber}</td>
									<td><img alt="图片不存在" src="${shop.picture }" width="100px" height="100px"></td>
									<td class="text-l">${shop.sname}</td>
									<td>${shop.sdescribe}</td>
									<td>${shop.price}</td>
									<c:if test="${shop.sstatic==0}">
	     								<td class="td-status"><span class="label label-success radius">下架</span></td>
	     							</c:if>
				     				<c:if test="${shop.sstatic==1}">
				     					<td class="td-status"><span class="label label-success radius">在售</span></td>
				     				</c:if>
									<td>${shop.stock}</td>
		    						<td>${shop.time}</td>
		    						<c:if test="${shop.addshop==2}">
	     							<td>未提交请求 <a href="<%=basePath%>shop/preupdateAddShop.do?shop_id=${shop.shop_id }"><span class="label label-success radius">下架/申请上架</a></td>
				     				</c:if>
				     				<c:if test="${shop.addshop==null}">
				     					<td>未提交请求 <a href="<%=basePath%>shop/preupdateAddShop.do?shop_id=${shop.shop_id }"><span class="label label-success radius">下架/申请上架</a></td>
				     				</c:if>
				     				<c:if test="${shop.addshop==0}">
				     					<td>申请上架  <a href="<%=basePath%>shop/preupdateAddShop.do?shop_id=${shop.shop_id }"><span class="label label-success radius">下架/申请上架</a></td>
				     				</c:if>
				     				<c:if test="${shop.addshop==1}">
				     					<td>上架审核通过  <a href="<%=basePath%>shop/preupdateAddShop.do?shop_id=${shop.shop_id }"><span class="label label-success radius">下架/申请上架</a></td>
				     				</c:if>
				     				<c:if test="${shop.addshop==3}">
				     					<td>商品已下架  <a href="<%=basePath%>shop/preupdateAddShop.do?shop_id=${shop.shop_id }"><span class="label label-success radius">下架/申请上架</a></td>
				     				</c:if>
				     				
					    			<c:if test="${shop.stype==0}">
				     					<td>提交请求</td>
				     				</c:if>
				     				<c:if test="${shop.stype==1}">
				     					<td>审核通过</td>
				     				</c:if>
				     				<c:if test="${shop.stype==null}">
				     					<td>未提交请求</td>
				     				</c:if>
				     				 <c:if test="${shop.stype==3}">
				     					<td>未提交请求</td>
				     				</c:if> 
				     				<c:if test="${shop.stype==2}">
				     					<td>商品已下架</td>
				     				</c:if>
				     				<c:if test="${shop.stype==4}">
				     					<td>审核未通过</td>
				     				</c:if>
									<td class="td-manage"> 
										<a href="<%=basePath%>shop/preUpdate.do?shop_id=${shop.shop_id }" style="text-decoration:none" class="ml-5" >修改</a> 
										<a href="<%=basePath%>shop/delete.do?shop_id=${shop.shop_id }" style="text-decoration:none">删除</a>
									</td>
								</tr>
					
							</c:forEach>
	    				</c:if>
	    			</tbody>
				</table>
			</form>
			
			<div class="box-footer">
				<div class="pull-left">
					<div class="form-group">
						总共${page.pages} 页，共${page.total} 条数据
					</div>
				</div>

				<div class="box-tools pull-right">
					<ul class="pagination">
						<%--在超链接中访问js函数，必须加前缀：javascript--%>
						<li><a href="<%=basePath%>shop/product_list.do?page=${page.firstPage}&uid=<%=uid%>">首页</a></li>
						<li><a href="<%=basePath%>shop/product_list.do?page=${page.prePage}&uid=<%=uid%>">上一页</a></li>

						<li><a href="<%=basePath%>shop/product_list.do?page=${page.nextPage}&uid=<%=uid%>">下一页</a></li>
						<li><a href="<%=basePath%>shop/product_list.do?page=${page.lastPage}&uid=<%=uid%>">尾页</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
var setting = {
	view: {
		dblClickExpand: false,
		showLine: false,
		selectedMulti: false
	},
	data: {
		simpleData: {
			enable:true,
			idKey: "id",
			pIdKey: "pId",
			rootPId: ""
		}
	},
	callback: {
		beforeClick: function(treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("tree");
			if (treeNode.isParent) {
				zTree.expandNode(treeNode);
				return false;
			} else {
				//demoIframe.attr("src",treeNode.file + ".html");
				return true;
			}
		}
	}
};		
$(document).ready(function(){
	var t = $("#treeDemo");
	t = $.fn.zTree.init(t, setting, zNodes);
	//demoIframe = $("#testIframe");
	//demoIframe.on("load", loadReady);
	var zTree = $.fn.zTree.getZTreeObj("tree");
	//zTree.selectNode(zTree.getNodeByParam("id",'11'));
});

$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  {"orderable":false,"aTargets":[0,7]}// 制定列不参与排序
	]
});
</script>
</body>
</html>
